<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('业务流程影像上传明细列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <form id="formId">
            <input type="hidden" name="docRegId" th:value="${docRegId}"/>
        </form>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "busiflw/docList";
    $(function () {
        var options = {
            url: prefix + "/list",
            modalName: "业务流程影像上传明细",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '明细编号',
                    visible: false
                },
                {
                    field: 'docRegId',
                    title: '档案编号'
                },
                {
                    field: 'fileName',
                    title: '文件名称',
                },
                {
                    field: 'fileType',
                    title: '文件类型',
                },
                {
                    field: 'fileUrl',
                    title: '文件',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (row.fileType == "doc" || row.fileType == "docx") {
                            return "";
                        } else if (row.fileType == "xlsx" || row.fileType == "xls") {
                            return "";
                        } else if (row.fileType == "pdf") {
                            return "";
                        } else {
                            return $.table.imageView(row.fileUrl, 600, 600);
                        }

                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="deleteDoc(\'' + row.id + '\',\'' + row.docRegId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function deleteDoc(id, docRegId) {
        $.modal.confirm("是否确认此操作？", function () {
            $.operate.post(prefix + "/delete", {
                "id": id,
                "docRegId": docRegId,
            });
        });
    }
</script>
</body>
</html>